Package edu.claflin.finder.algo
Class ArgumentsBundle
- java.lang.Object
-
- edu.claflin.finder.algo.ArgumentsBundle
-
public class ArgumentsBundle extends java.lang.ObjectUsed to supply arguments to Algorithms in a generalized manner. The caller is required to put arguments on the bundle prior to passing it to the Algorithm's constructor. The algorithm, then, can interpret the arguments it wants to and ignore others. This generalizes the constructor of the abstract Algorithm object so that algorithms that take different arguments may be created without complicating the constructors of others. Specifically, the bundle supports the following kinds of arguments: - Enums - Integers - Floats - Objects - a special Condition object list- Version:
- 3.0 February 2, 2016
- Author:
- Charles Allen Schultz II
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArgumentsBundle.COMMON_ARGSAn enumeration containing common arguments used by the program.
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,java.lang.Boolean>booleanListThe Mapping of String keywords to Notable Boolean values.private java.util.ArrayList<Condition>conditionsListThe List of conditions to apply to the Algorithm.private java.util.HashMap<java.lang.String,java.lang.Double>doubleListThe Mapping of String keywords to Notable Double values.private java.util.HashMap<java.lang.String,java.lang.Enum>enumListThe Mapping of String keywords to Notable Enum values.private java.util.HashMap<java.lang.String,java.lang.Integer>integerListThe Mapping of String keywords to Notable Integer values.private java.util.HashMap<java.lang.String,java.lang.Object>objectsListThe Mapping of String keywords to Notable objects.
-
Constructor Summary
Constructors Constructor Description ArgumentsBundle()Constructs the ArgumentsBundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCondition(Condition condition)Adds a Condition to the conditionsList.java.lang.BooleangetBoolean(java.lang.String key)Gets a boolean from the booleanList.java.util.List<Condition>getConditionsList()Gets a copy of the conditionsList that will not structurally modify the one owned by the bundle.java.lang.DoublegetDouble(java.lang.String key)Gets a double from the doubleList.java.lang.EnumgetEnum(java.lang.String key)Gets an enum from the enumList.java.lang.IntegergetInteger(java.lang.String key)Gets an integer from the integerList.java.lang.ObjectgetObject(java.lang.String key)Gets an object from the enumList.voidputBoolean(java.lang.String key, java.lang.Boolean val)Puts a boolean in the booleanList.voidputDouble(java.lang.String key, java.lang.Double val)Puts a double in the doubleList.voidputEnum(java.lang.String key, java.lang.Enum val)Puts an enum in the enumList.voidputInteger(java.lang.String key, java.lang.Integer val)Puts an integer in the integerList.voidputObject(java.lang.String key, java.lang.Object val)Puts an object in the enumList.voidremoveBoolean(java.lang.String key)Removes a boolean from the booleanList.voidremoveCondition(Condition condition)Removes a Condition from the conditionsList.voidremoveDouble(java.lang.String key)Removes a double from the doubleList.voidremoveEnum(java.lang.String key)Removes an enum from the enumList.voidremoveInteger(java.lang.String key)Removes an integer from the integerList.voidremoveObject(java.lang.String key)Removes an object from the enumList.java.lang.StringtoString()
-
-
-
Field Detail
-
conditionsList
private final java.util.ArrayList<Condition> conditionsList
The List of conditions to apply to the Algorithm.
-
integerList
private final java.util.HashMap<java.lang.String,java.lang.Integer> integerList
The Mapping of String keywords to Notable Integer values.
-
doubleList
private final java.util.HashMap<java.lang.String,java.lang.Double> doubleList
The Mapping of String keywords to Notable Double values.
-
booleanList
private final java.util.HashMap<java.lang.String,java.lang.Boolean> booleanList
The Mapping of String keywords to Notable Boolean values.
-
enumList
private final java.util.HashMap<java.lang.String,java.lang.Enum> enumList
The Mapping of String keywords to Notable Enum values.
-
objectsList
private final java.util.HashMap<java.lang.String,java.lang.Object> objectsList
The Mapping of String keywords to Notable objects.
-
-
Method Detail
-
addCondition
public void addCondition(Condition condition)
Adds a Condition to the conditionsList.- Parameters:
condition- the Condition object to add.
-
removeCondition
public void removeCondition(Condition condition)
Removes a Condition from the conditionsList.- Parameters:
condition- the Condition object to remove.
-
getConditionsList
public java.util.List<Condition> getConditionsList()
Gets a copy of the conditionsList that will not structurally modify the one owned by the bundle.- Returns:
- a List of Conditions held in this ArgumentsBundle.
-
putInteger
public void putInteger(java.lang.String key, java.lang.Integer val)Puts an integer in the integerList.- Parameters:
key- the String keyword which maps to the integer.val- the Integer to put.
-
removeInteger
public void removeInteger(java.lang.String key)
Removes an integer from the integerList.- Parameters:
key- the String keyword which maps to the integer.
-
getInteger
public java.lang.Integer getInteger(java.lang.String key)
Gets an integer from the integerList.- Parameters:
key- the String keyword which maps to the integer.- Returns:
- the Integer in the list or null if not present.
-
putDouble
public void putDouble(java.lang.String key, java.lang.Double val)Puts a double in the doubleList.- Parameters:
key- the String keyword which maps to the double.val- the Double to put.
-
removeDouble
public void removeDouble(java.lang.String key)
Removes a double from the doubleList.- Parameters:
key- the String keyword which maps to the double.
-
getDouble
public java.lang.Double getDouble(java.lang.String key)
Gets a double from the doubleList.- Parameters:
key- the String keyword which maps to the double.- Returns:
- the Double in the list or null if not present.
-
putBoolean
public void putBoolean(java.lang.String key, java.lang.Boolean val)Puts a boolean in the booleanList.- Parameters:
key- the String keyword which maps to the boolean.val- the Boolean to put.
-
removeBoolean
public void removeBoolean(java.lang.String key)
Removes a boolean from the booleanList.- Parameters:
key- the String keyword which maps to the boolean.
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String key)
Gets a boolean from the booleanList.- Parameters:
key- the String keyword which maps to the boolean.- Returns:
- the Boolean in the list or null if not present.
-
putEnum
public void putEnum(java.lang.String key, java.lang.Enum val)Puts an enum in the enumList.- Parameters:
key- the String keyword which maps to the enum.val- the Enum to put.
-
removeEnum
public void removeEnum(java.lang.String key)
Removes an enum from the enumList.- Parameters:
key- the String keyword which maps to the enum.
-
getEnum
public java.lang.Enum getEnum(java.lang.String key)
Gets an enum from the enumList.- Parameters:
key- the String keyword which maps to the enum.- Returns:
- the Enum in the list or null if not present.
-
putObject
public void putObject(java.lang.String key, java.lang.Object val)Puts an object in the enumList.- Parameters:
key- the String keyword which maps to the object.val- the Object to put.
-
removeObject
public void removeObject(java.lang.String key)
Removes an object from the enumList.- Parameters:
key- the String keyword which maps to the object.
-
getObject
public java.lang.Object getObject(java.lang.String key)
Gets an object from the enumList.- Parameters:
key- the String keyword which maps to the object.- Returns:
- the Object in the list or null if not present.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-